
app.controller('landexportImgCtrl', function($element, $scope, $state, rest, user, uploadConf, tipService, $window, $rootScope,decoJavaUrlLsf) {
    $scope.idstring = angular.copy($scope.ngDialogData, {});
    var token = $window.localStorage.getItem("token");
    
    rest.decoJava({
        type: "post",
        url: "/tenancy-sys/landlord/getlandlordConfigParam",
        data: "",
        beforeSend: function(request) {
            request.setRequestHeader("token", token);
        },
        success: function(res) {
            $scope.ExcelDatas = res;
            $scope.$apply();
            $("#_ajaxForm").attr("action",decoJavaUrlLsf+"/tenancy-sys/landlord/exportLandlordImg"); //form请求地址
        }
    })
    
    
    $(document).on("click",".checkboxBar span input[type='checkbox']",function(){
        var index = $(this).attr("data-index");
        if($(this).is(":checked")){
            $(".checkboxBar2 span input[data-index='"+index+"']").prop("checked",true);
        } else{
            $(".checkboxBar2 span input[data-index='"+index+"']").prop("checked",false);
        }
        
        //数据处理1
        var keysArr = [];
        angular.element(".checkboxBar span input[type='checkbox']").each(function() {
            if ($(this).is(":checked")) {
                keysArr.push($(this).val());
            }
        });
        var _keysstring = "";
        angular.forEach(keysArr, function(data) {
            _keysstring += data + ',';
        })
        var _keysstring = _keysstring.substring(0, _keysstring.length - 1);
        //数据处理2
        var colArr = [];
        angular.element(".checkboxBar2 span input[type='checkbox']").each(function() {
            if ($(this).is(":checked")) {
                colArr.push($(this).val());
            }
        });
        var colstring = "";
        angular.forEach(colArr, function(data) {
            colstring += data + ',';
        })
        var colstring = colstring.substring(0, colstring.length - 1);
        $scope.keysstring = _keysstring
        $scope.colstring = colstring
        $scope.$apply();
        
    });
    
    $scope.exportData = function(){
        // if($scope.keysstring == "" || $scope.keysstring == undefined){
        //     layer.msg("没有选中项", {
        //         offset: 't',
        //         icon: 2
        //     });
        // } else{
        //     $("#_ajaxForm").submit();
        // }
          $("#_ajaxForm").submit();
          $scope.closeThisDialog();
    }
    
    $scope.hideBtn = function(){
        $scope.closeThisDialog();
    }
    
});
